package com.roc.base.mall.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil extends DateUtilParent {

	public static String getDateByday(int day) {
		Date d = new Date();
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		if (day > 0) {
			return df.format(new Date(d.getTime() + (long) day * 24 * 60 * 60 * 1000)).replace("-", "");
		} else {
			return df.format(new Date(d.getTime() - (long) day * 24 * 60 * 60 * 1000)).replace("-", "");
		}

	}

	public static String getDateByday(Date d, int day) {
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		if (day > 0) {
			return df.format(new Date(d.getTime() + (long) day * 24 * 60 * 60 * 1000)).replace("-", "");
		} else {
			return df.format(new Date(d.getTime() - (long) day * 24 * 60 * 60 * 1000)).replace("-", "");
		}
	}

}